﻿/*
 * Created by SharpDevelop.
 * User: lebeda
 * Date: 26.2.2014
 * Time: 19:51
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using NUnit.Framework;

namespace simpleExplorer.tests
{
    
    [TestFixture]
    public class TestReplace
    {
        
        private MenuItem menuItem = null;
        
        [SetUp]
        public void Init()
        {
            menuItem = new MenuItem("menu caption", ItemTarget.menu, ItemType.filesystemMenuProvider,
                                    @"c:\programs.pub\simpleExplorer\simpleExplorer.exe", "menu params",
                                    @"c:\programs.pub\simpleExplorer", null);
        }

        [Test]
        public void replaceNone()
        {
            Assert.AreEqual("test test", Tools.replaceConfig("test test", menuItem));
            
        }
        
        [Test]
        public void replaceConfig()
        {
            Assert.AreEqual("test "+Tools.configDirName()+" test", Tools.replaceConfig("test %CONFIGDIR% test", menuItem));
            
        }
        
        [Test]
        public void replaceCAPTION()
        {
            Assert.AreEqual("test menu caption test", Tools.replaceConfig("test %CAPTION% test", menuItem));
        }
        
        [Test]
        public void replacePARAM()
        {
            Assert.AreEqual("test menu params test", Tools.replaceConfig("test %PARAM% test", menuItem));
        }
        
        [Test]
        public void replaceCMD()
        {
            Assert.AreEqual(@"test c:\programs.pub\simpleExplorer\simpleExplorer.exe test", Tools.replaceConfig("test %CMD% test", menuItem));
        }
        
        [Test]
        public void replaceDIR()
        {
            Assert.AreEqual(@"test c:\programs.pub\simpleExplorer test", Tools.replaceConfig("test %DIR% test", menuItem));
        }
        
        [Test]
        public void replaceEXT()
        {
            Assert.AreEqual("test .exe test", Tools.replaceConfig("test %EXT% test", menuItem));
        }
        
        [Test]
        public void replaceFNAME()
        {
            Assert.AreEqual("test simpleExplorer test", Tools.replaceConfig("test %FNAME% test", menuItem));
        }
        
    }
}
